<?php

require_once dirname(__FILE__).'/../lib/jobGeneratorConfiguration.class.php';
require_once dirname(__FILE__).'/../lib/jobGeneratorHelper.class.php';

/**
 * job actions.
 *
 * @package    jobeet
 * @subpackage job
 * @author     Your name here
 * @version    SVN: $Id: actions.class.php 12474 2008-10-31 10:41:27Z fabien $
 */
class jobActions extends autoJobActions
{
    public function executeBatchExtend(sfRequest $request)
    {
        $ids = $request->getParameter('ids');
        $jobs = JobeetJobPeer::retrieveByPKs($ids);
        foreach($jobs as $job)
        {
            $job->extend(true);
        }
        
        $this->getUser()->setFlash('notice', 'Wybrane oferty zostały automatycznie przedłuzone');
        $this->redirect('jobeet_job');
    }
    
    public function executeListExtend(sfRequest $request)
    {
        $job = $this->getRoute()->getObject();
        $job->extend(true);
        
        $this->getUser()->setFlash('notice', 'Your selected Job was extended');
        $this->redirect('jobeet_job');
    }
    
    public function executeListDeleteNeverActivated(sfRequest $request)
    {
        $nb = JobeetJobPeer::cleanup(60);
        if($nb)
        {
            $this->getUser()->setFlash('notice', 'Wszystkie nieaktywne oferty zostały usuniete');
            
        }
        else
        {
            $this->getUser()->setFlash('notice', 'Nie usunieto żadnej oferty');
        }
        $this->redirect('jobeet_job');
    }
}
